package com.secxiot.provider.user.vo;

import com.secxiot.provider.user.dto.DeptDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.ToString;

import java.io.Serializable;
import java.util.Objects;

@ApiModel
@ToString(callSuper = true)
@Data
@AllArgsConstructor
@Builder
public class DeptVo implements Serializable {

    private static final long serialVersionUID = 6554703376762539108L;

    public DeptVo() {

    }

    public DeptVo(DeptDto deptDto) {
        this.parentId = deptDto.getParentId();
        this.deptId = deptDto.getDeptId();
        this.deptName = deptDto.getName();
        this.deptLevel = deptDto.getDeptLevel();
        this.leafNode = deptDto.getLeafNode();
    }

    @ApiModelProperty(value = "父级部门id", required = true)
    private Long parentId;

    @ApiModelProperty(value = "部门名称", required = true)
    private String deptName;

    @ApiModelProperty(value = "部门Id", required = true)
    private Long deptId;

    @ApiModelProperty(value = "部门等级，1为医院", required = true)
    private Integer deptLevel;

    @ApiModelProperty(value = "是否是叶子节点 1：是 0：否", required = true)
    private Integer leafNode;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        DeptVo deptVo = (DeptVo) o;
        return Objects.equals(deptLevel, deptVo.deptLevel);
    }

}
